import pymongo
handler = pymongo.MongoClient().chapter_7.example_user
rows = handler.aggregate([

    {'$lookup': {
        'from': 'example_post',
        'localField': 'user_id',
        'foreignField': 'id',
        'as': 'user_info'
    }},
    {'$match': {'name': '张小二'}},
    {'$unwind': '$user_info'},
    {'$project': {'name': 1,
                  'work': 1,
                  'content': '$weibo_info.content',
                  'post_time': '$weibo_info.post_time'}}
])
for row in rows:
    print(row)